#!/bin/bash
#before install check DB setting in 
#	baogia.conf 
#and run this with root

#CENTOS/REDHAT/FEDERA WEBBASE=/var/www/html APACHEUSER=apache 
WEBBASE=/var/www/
APACHEUSER=www-data
DBUSER=root
DBPASS=sql#2012

#try install tools
sudo apt-get update
sudo apt-get install flex g++ libmysql++-dev php5 apache2 mysql-server php5-mysql php5-gd php5-cli mono-gmcs libapache2-mod-php5 curl libcurl3 libcurl3-dev php5-curl

#sudo yum -y update
#sudo yum -y install php httpd php-mysql mysql-server php-xml php-gd gcc-c++  mysql-devel php-mbstring glibc-static


#compile and install the core


#create work dir set default conf
sudo cp baogia.conf /etc
date >/var/log/baogia.log
date >/var/log/baogia_post.log


#boot up bao gia vang
sudo cp baogia /etc/init.d/
sudo chmod +x  /etc/init.d/baogia
sudo ln -s /etc/init.d/baogia /etc/rc3.d/S93baogia
sudo ln -s /etc/init.d/baogia /etc/rc2.d/S93baogia

rm -f giavang
make giavang
sudo cp giavang /usr/bin
